package shejimoshi.zerenlianmoshi;

public class client {
    public static void main(String[] args) {
        Handler handler1 = new ConcreteHandler1();
        Handler handler2 = new ConcreteHandler2();

        handler1.setNext(handler2); // 创建责任链

        Request request1 = new Request("A");
        handler1.handleRequest(request1); // 由 ConcreteHandler1 处理

        Request request2 = new Request("B");
        handler1.handleRequest(request2); // 由 ConcreteHandler2 处理

        Request request3 = new Request("C");
        handler1.handleRequest(request3); // 没有处理者处理，打印未找到处理者的消息
    }
}
